Contents ----- Copyright Up Previous Next

Makefile

Inside the starter-project-drawer, you can find an rather empty Makefile to be used for new projects. This will be a short explanation of the symbols and rules defined in this Makefile.

Symbols

DESTDIR =/docs/
IGNORE  =ign=46
PRJFILE =hsc.project
STDINC  =inc/my_macros.hsc
HSCMISC =rplcent

DESTDIR describes the destination-directory for your html-objects and is relative to the path where you invoke make (and usually your hsc-sources are located, too). IGNORE specifies which messages should be ignored, PRJFILE is the project-file to be used both by hsc and hscdepp. STDINC specifies include-files which should be processed within the command-call invoking hsc from the Makefile; these files will be included for all hsc-sources. HSCMISC contains all other options and switches that should be passed to hsc.

HSC     =hsc
HSCFLAGS=$(HSCMISC) $(IGNORE) prjfile=$(PRJFILE) to=$(DESTDIR) $(STDINC)

HSC is the command to be used to invoke hsc; if it isn't already in your search-path, you can also enter the full path here. HSCFLAGS is computed from the values above and contains all parameters for hsc, exept the main hsc-source.

HSCDEPP =hscdepp

This is the command to be used to invoke hscdepp.

Rules

$(DESTDIR)%.html : %.hsc
        $(HSC) $(HSCFLAGS) $<

This is a pattern rule that will create a html-object in DESTDIR using the corresponding hsc-source and the options you specified above. The automatic variable "$<" contains the name of the first dependency, normally this is the main hsc-source.

depend :
        $(HSCDEPP) file=Makefile prjfile=$(PRJFILE) verbose

This rule will invoke hscdepp and update your dependencies; this will modify your Makefile.

NEW :
        $(HSC) $(HSCFLAGS) $(INCLUDE) from=$(FILE)

This rule can be useful to add new files to the project. You can also use it to change the include-dependencies of an already existing file. This just updates the project-file, but not the Makefile, so make sure to invoke make depend afterwards.

For example, you could use

       make NEW FILE=newfile.hsc

to add newfile.hsc to the project.

Pre- And Post Processing

A fine thing about the pattern rule used above to create your html-object is that it can be extended to do several things before or after hsc performes its task.

For example, extending it to

$(DESTDIR)%.html : %.hsc
        $(HSC) $(HSCFLAGS) $<
        chmod 644 $@

will make sure that the file-permission-bits are set to the usual value required by w3-documents. This, of course, works only for Unixoid systems.

If you are using AmigaOS and have AWeb running, you can use

$(DESTDIR)%.html : %.hsc
        $(HSC) $(HSCFLAGS) $<
        rx SendBrowser.rexx $@

to immediately display updated documents in your browser. The Rexx-Script SendBrowser.rexx can be found in the grafflwerk-drawer of the hsc-archive.

You can also use a better syntax checker than hsc on your newly created document:

$(DESTDIR)%.html : %.hsc
        $(HSC) $(HSCFLAGS) $<
        CheckHTLM $@

Note that errors found during the second check are reported from the html object and might be a bit difficult to backtrace in the hsc source.